package assist.domain.model;

public class ZoneEvent extends Event
{
    private static final long serialVersionUID = 1L;
    public enum Zone
    {
        NEUTRAL, OFFENSIVE, DEFENSIVE;
    }
    private Zone zone;
    
    /**
     * Convienience methods, allows setting zone using strings: Neu/Neutral,
     * Offensive/Off, Defensive/Def,
     * @param zone the zone to set
     */
    public void setZone(final String zone)
    {
        //Not all penalties have zone info, for some reason.
        if (zone == null)
        {
            this.zone = null;
            return;
        }
        String zoneAbbrev = zone.substring(0, 3);
        if (zoneAbbrev.equalsIgnoreCase("Off"))
        {
            this.zone = Zone.OFFENSIVE;
        }
        else if (zoneAbbrev.equalsIgnoreCase("Neu"))
        {
            this.zone = Zone.NEUTRAL;
        }      
        else if (zoneAbbrev.equalsIgnoreCase("Def"))
        {
            this.zone = Zone.DEFENSIVE;
        }         
    }
    
    /**
     * @param zone the zone to set
     */
    public void setZone(final Zone zone)
    {
        this.zone = zone;
    }
    /**
     * @return the zone
     */
    public Zone getZone()
    {
        return zone;
    }
}
